import React, { PureComponent } from 'react';

class Loading extends PureComponent {
  render() {
    const {
      error,
      retry,
      timedOut,
      pastDelay,
    } = this.props;
    let view = null;
    if (error) {
      view = <Loading type="error" retry={retry} />;
    } else if (timedOut) {
      view = <Loading type="timeout" retry={retry} />;
    } else if (pastDelay) {
      view = <Loading type="loading" retry={retry} />;
    }
    return view;
  }
}

export default Loading;
